from abc import ABC, abstractmethod
from typing import Any

#calling process:
#   ServerProxy --render--> IServerProxyImpl --render--> IServerProxyImpl.stub

from bcat.rpc.client.server_proxy_impl import  IServerProxyImpl

class IServerProxy(ABC):
    @abstractmethod
    def init(self) -> bool:
        pass
    @abstractmethod
    def deinit(self) -> bool:
        pass

    @abstractmethod
    def url(self) -> str:
        pass

    @abstractmethod
    def impl(self) -> IServerProxyImpl:
        pass

    
class ServerProxy(IServerProxy):
    def __init__(self, url: str, impl: IServerProxyImpl):
        self.__url = url
        self.__impl = impl

    def init(self) -> bool:
        return True
    def deinit(self) -> bool:
        return True

    def url(self) -> str:
        return self.__url

    def impl(self) -> IServerProxyImpl:
        return self.__impl

